🎖️GitЯра🎖️
Node / meshtastic / Meshtastic-Android / files / androidApp / src / test / kotlin / org / meshtastic / app / map / SitePlannerWebViewRecoveryTest.kt
Displaying Raw • Download
androidApp/src/test/kotlin/org/meshtastic/app/map/SitePlannerWebViewRecoveryTest.kt bd2863243bab6eb213401d949839a2bc74dde7e2 (bd286324) Text, 2.48 KB
T8b949e/*
* Copyright (c) 2026 Meshtastic LLC
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
Tff7b72package T7ee787org.meshtastic.app.map
Tff7b72import T7ee787android.app.Application
Tff7b72import T7ee787android.content.res.Resources
Tff7b72import T7ee787android.util.AndroidRuntimeException
Tff7b72import T7ee787org.junit.runner.RunWith
Tff7b72import T7ee787org.robolectric.RobolectricTestRunner
Tff7b72import T7ee787org.robolectric.annotation.Config
Tff7b72import T7ee787kotlin.test.Test
Tff7b72import T7ee787kotlin.test.assertFalse
Tff7b72import T7ee787kotlin.test.assertTrue
T8b949e/**
* Classifier guard for the Site Planner WebView provider-update mitigation: only the two exception shapes the AOSP
* provider-update race produces may be absorbed and retried; anything else must keep propagating.
*/
Tf0883e@RunWithTb4b4b4(Te6edf3RobolectricTestRunnerTff7b72::Te6edf3classTb4b4b4)
T8b949e// Bare Application: booting the real MeshUtilApplication leaks its scopes across tests (#6644).
Tf0883e@ConfigTb4b4b4(Te6edf3application Tff7b72= Te6edf3ApplicationTff7b72::Te6edf3classTb4b4b4, Te6edf3sdk Tff7b72= Tff7b72[T79c0ff3T79c0ff4Tff7b72]Tb4b4b4)
Tff7b72class T56d364SitePlannerWebViewRecoveryTest Tb4b4b4{
Tf0883e@Test
Tff7b72fun Td2a8ff`resources redirect race is recoverable`Tb4b4b4(Tb4b4b4) Tb4b4b4{
Tff7b72val Te6edf3race Tff7b72= Te6edf3ResourcesTb4b4b4.Te6edf3NotFoundExceptionTb4b4b4(Ta5d6ff"Ta5d6fffailed to redirect ResourcesImplTa5d6ff"Tb4b4b4)
Te6edf3assertTrueTb4b4b4(Te6edf3isWebViewProviderUpdateExceptionTb4b4b4(Te6edf3raceTb4b4b4)Tb4b4b4)
Tb4b4b4}
Tf0883e@Test
Tff7b72fun Td2a8ff`webview provider load failure wrapper is recoverable`Tb4b4b4(Tb4b4b4) Tb4b4b4{
Tff7b72val Te6edf3wrapper Tff7b72=
Te6edf3AndroidRuntimeExceptionTb4b4b4(
Ta5d6ff"Ta5d6ffandroid.webkit.WebViewFactoryTa5d6ff\Tffd700$Te6edf3MissingWebViewPackageExceptionTa5d6ff: Failed to load WebView provider: No WebView installedTa5d6ff"Tb4b4b4,
Tb4b4b4)
Te6edf3assertTrueTb4b4b4(Te6edf3isWebViewProviderUpdateExceptionTb4b4b4(Te6edf3wrapperTb4b4b4)Tb4b4b4)
Tb4b4b4}
Tf0883e@Test
Tff7b72fun Td2a8ff`unrelated AndroidRuntimeException is not swallowed`Tb4b4b4(Tb4b4b4) Tb4b4b4{
Tff7b72val Te6edf3unrelated Tff7b72= Te6edf3AndroidRuntimeExceptionTb4b4b4(Ta5d6ff"Ta5d6ffCalling startActivity() from outside of an Activity contextTa5d6ff"Tb4b4b4)
Te6edf3assertFalseTb4b4b4(Te6edf3isWebViewProviderUpdateExceptionTb4b4b4(Te6edf3unrelatedTb4b4b4)Tb4b4b4)
Tb4b4b4}
Tf0883e@Test
Tff7b72fun Td2a8ff`unrelated RuntimeException is not swallowed`Tb4b4b4(Tb4b4b4) Tb4b4b4{
Te6edf3assertFalseTb4b4b4(Te6edf3isWebViewProviderUpdateExceptionTb4b4b4(Te6edf3IllegalStateExceptionTb4b4b4(Ta5d6ff"Ta5d6ffboomTa5d6ff"Tb4b4b4)Tb4b4b4)Tb4b4b4)
Tb4b4b4}
Tb4b4b4}
Served by rngit 1.5.0 - Generated in 0.04s